/** ****************************************************************************
 * CopyRight (C) 2012 Sharadendu Sinha.
 * Licensing : FreeBSD 
 *
 * @(#) $Id$
 */
package com.sps.signalling;

import java.util.List;

import com.sps.signalling.Invokable.Type;
import com.sps.signalling.exceptions.SignallingException;

/**
 * Base interface for {@link SignalEmmiter} and {@link SlotProvider}
 * 
 * @version 1.1
 * @author sharadendu
 */
public interface InvokableProvider
{
	/**
	 * Add {@link Invokable} to registered list of {@link Invokable} i.e
	 * {@link Signal} or {@link Slot}
	 * 
	 * @param invokable {@link Invokable}
	 */
	void addInvokable(Invokable invokable);

	/**
	 * Returns the {@link Invokable} by the name passed in parameter associated
	 * with this {@link InvokableProvider}. This method throws
	 * {@link SignallingException} is {@link Invokable} is not found by the
	 * given name.
	 * 
	 * @param name
	 * @return {@link Invokable}
	 * @throws SignallingException
	 */
	Invokable getInvokableByName(String name) throws SignallingException;

	/**
	 * Returns the {@link Invokable} by the name passed in parameter associated
	 * with the {@link InvokableProvider} passed as parameter. This method
	 * throws {@link SignallingException} is {@link Invokable} is not found by
	 * the given name.
	 * 
	 * @param name name of the {@link Invokable}
	 * @param invokableProvider {@link InvokableProvider}
	 * @return {@link Invokable} if found
	 * @throws SignallingException if no {@link Invokable} is found
	 */
	Invokable getInvokableByName(InvokableProvider invokableProvider,
		String name) throws SignallingException;

	/**
	 * This is a utility method that can be used to find all the
	 * {@link Invokable}s provided by a class implementing the
	 * {@link InvokableProvider} interface
	 * 
	 * @param type {@link Type}
	 * @return {@link List} of all {@link Invokable}s of the given type
	 */
	List<Invokable> getInvokables(Type type);
}
